package vip.lsjscl.flowboot.util;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import vip.lsjscl.flowboot.util.model.User;

import java.util.List;

/**
 * 用户信息持有者
 * 用于在框架内部获取当前用户信息
 *
 * @author zhangxingju
 * @date 2025/02/15
 */
@Component
@RequiredArgsConstructor
public class UserInfoHolder {

    private final UserInfoProvider userInfoProvider;

    public String getCurrentUserId() {
        return userInfoProvider != null ? userInfoProvider.getCurrentUserId() : null;
    }

    public String getCurrentUsername() {
        return userInfoProvider != null ? userInfoProvider.getCurrentUsername() : null;
    }


    public List<User> getUserListByUserIds(List<String> userIds) {
        return userInfoProvider != null ? userInfoProvider.getUserListByUserIds(userIds) : null;
    }

    public String getCurrentDeptId() {
        return userInfoProvider != null ? userInfoProvider.getCurrentDeptId() : null;
    }

}